package cn.wolfcode.wolf2w.common.redis.util;

import lombok.Getter;

/**
 * Redis key的工具类
 */
@Getter
public enum RedisKeys {

    BRUSH("brush",Consts.MAX_BRUSH_TIME * 60l),
    ES_DATA("es_data",-1l),
//    VERIFY_CODE("verify_code",3 * 60l),
    VERIFY_CODE("verify_code",Consts.VERIFY_CODE_TIME * 60l),
    STRATEGY_THUMBSUP("strategy_thumbsup",-1l),
    USER_STRATEGY_FAVOR("user_strategy_favor",-1l),
    STRATEGY_STATIS_HASH_INIT("strategy_statis_hash_init",-1l), //攻略统计数据初始化标识
    STRATEGY_STATIS_HASH("strategy_statis_hash",-1l); //攻略的统计数据

    private Long time; //过期时间 -1表示没有过期时间
    private String prefix; //key的前缀

    private RedisKeys(String prefix,Long time){
        this.time = time;
        this.prefix = prefix;
    }

    public String join(String... values){
        StringBuffer sb = new StringBuffer();
        sb.append(this.prefix);
        for (String value : values) {
            sb.append(":")
                    .append(value);
        }
        return sb.toString();
    }
}
